package com.chuangsi.common.utils;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:application.yml")
@Data
public class ConfigUtil {

    @Value("${spring.profiles.active}")
    private String profilesActive;



//    @Value("${gzh.app-id}")
//    private String gzhAppId;
//
//    @Value("${gzh.app-secret}")
//    private String gzhAppSecret;
//
//    @Value("${gzh.approve-template-id}")
//    private String gzhApproveTemplateId;
//
//    @Value("${gzh.approve-result-template-id}")
//    private String gzhApproveResultTemplateId;
//
//    @Value("${gzh.service-template-id}")
//    private String gzhServiceTemplateId;


    @Value("${uploads.path.winPath}")
    private String winPath;
    @Value("${uploads.path.linuxPath}")
    private String linuxPath;
    @Value("${uploads.path.winUrl}")
    private String winUrl;
    @Value("${uploads.path.linuxUrl}")
    private String linuxUrl;


    public String getPath(){
        String os = System.getProperty("os.name");
        if (os.toLowerCase().contains("linux")) {
            return linuxPath;
        } else {
            return winPath;
        }
    }

    /**
     * 根据系统获取IP地址
     * @return
     */
    public  String getUrl(){
        String os = System.getProperty("os.name");
        if (os.toLowerCase().contains("linux")) {
            return linuxUrl;
        } else {
            return winUrl;
        }
    }


}
